package com.winter.Controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.winter.model.FinManage;
import com.winter.service.FinManageService;
import com.winter.util.Result;

@RestController
@RequestMapping("v1/fin_manage")
public class FinManageController {

    @Autowired
    public FinManageService finManageService;

    /**
     * 查询报价平台理财List信息
     */
    @GetMapping("/finManageList")
    public Result finManageList(Integer pageNumber, Integer pageSize, String direct, String fund_mode, String loi, String termUnit, String userNo, String sortName, String sort, String key) {

        return finManageService.finManageList(pageNumber, pageSize, direct, fund_mode, loi, termUnit, userNo, sortName, sort, key);
    }

    /**
     * 通过id查询报价平台理财信息
     */
    @GetMapping("/finManageId")
    public Result finManageId(Long id, String userNo) {
        return finManageService.getFinManageId(id, userNo);
    }

    /**
     * 新增报价平台理财信息
     */
    @PostMapping("/insertFinManage")
    public Result insertFinManage(@RequestBody FinManage fm) {
        return finManageService.insertFinManage(fm);
    }

    @PutMapping("/updateFinManage")
    public Result updateFinManage(@RequestBody FinManage fm) {
        return finManageService.updateFinManage(fm);
    }
}
